package per.ethan.cloud.common.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author Ethan
 * @date 2020/03/10 19:57
 */

@Mapper
public interface BaseMapper<Entity> {

    void save(Entity entity);

    void update(Entity entity);

    void batchUpdate(Map<String, Object> map);

    void deleteByWhere(Map<String, Object> map);

    void logicDeleteByWhere(Map<String, Object> map);

    void deleteById(@Param("id") Long id);

    void logicDeleteById(@Param("id") Long id);

    void batchDelete(@Param("idList") List<Long> idList);

    void logicBatchDelete(@Param("idList") List<Long> idList);

    Entity findById(@Param("id") Long id);

    Entity findByName(@Param("name") String name);

    List<Entity> findAll();

    List<Entity> findByMap(Map<String, Object> map);

    Integer getCount(Map<String, Object> map);

    List<Entity> findByPage(Map<String, Object> map);

    void batchSave(@Param("entityList") List<Entity> entityList);

}
